package com.example.properties.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Spring Configuration 和 Component 区别（精简汇总版）
 * 参考：https://www.toutiao.com/i6636541118316020231/
 */

//@Configuration
@Data
@Component
@ConfigurationProperties(prefix = "student")
public class Student {

    private String lastName;
    private Integer age;
    private Boolean boss;
    private Date birth;
    private Map<String,Object> maps;
    private List<Object> lists;
    private Book  book;

    /**
     * 特别注意！！特别注意！！：如果通过前缀的方式注入，一定要有get set 方法
     * @return
     */

    @Override
    public String toString() {
        return "Student{" +
                "lastName='" + lastName + '\'' +
                ", age=" + age +
                ", boss=" + boss +
                ", birth=" + birth +
                ", maps=" + maps +
                ", lists=" + lists +
                ", book=" + book +
                '}';
    }
}
